import random
i = random.randint(0, 100)
n = 1
while True:
    guss_num = eval(input('请输入要猜的数字(0~100)：'))
    if 0 <= guss_num <= 100:

        if guss_num == i:
            print(f'预测了{n}次,你猜中了!')
            pass
        elif guss_num < i:
            print('遗憾，太小了')
            n += 1
        elif guss_num > i:
            print('遗憾，太大了')
            n += 1
        else:
            print('输入的格式有误请重输入')
